<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>檀木高精度定位</title>
  <style>
    html, body {width:  100%; height: 100%; margin: 0px; background: #FFFFFF; font-family: Tahoma, Geneva, Arial, sans-serif;}
    #container {width: 100%; top:0px; bottom: 35px; overflow: auto;}
    #footer {position: fixed; width: 100%; height: 35px; bottom: 0px; background: #fff; color: white;}

    #mapSwitcher {position:absolute; width: 100%; padding-left: 50%;}
    #tagContainer {position:absolute; width:100%; height:100%; top:0; left: 0; background: #111111; overflow-y:scroll;}
    #mapContainer {position:absolute; top:0; right:0; width:100%; height:100%;}
    #show2DMap {position: absolute; bottom: 10px; left: 10px; }
    #show3DMap {position: absolute; bottom: 10px; left: 90px; }
    .mapSwitcherButton {border-radius:5px; border-width:1px; width: 70px; border-color: #FFFFFF;}
    .mapPanel {position:absolute; width:100%; height:100%;}
    canvas { width: 100%; height: 100% }
    #zoomIn {position: absolute; top: 5px; left: 5px; }
    #zoomOut {position: absolute; top: 55px; left: 5px; }
    #rotateCW {position: absolute; top: 5px; left: 55px; }
    #rotateCCW {position: absolute; top: 55px; left: 55px; }
    #drawer { top: 50%; left: 0px; }
    #LogoSlogan {position: absolute; bottom: 10px; right: 10px; opacity: 0.2; height:150px;}
    .inputContainer {position: absolute; padding:3px; margin: 3px; width: 200px; height: 20px; -webkit-border-radius:4px;
      -moz-border-radius:4px; border-radius:4px; -webkit-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset; -moz-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
      box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset; background: #f8f8f8; border:none; outline:none;}

    #tagIDFilter { left: 210px; }
    #tagFieldFilter { left: 420px; }
    #positionOptimize {position: absolute; right: 10px; padding:3px; margin: 3px; height: 30px; -webkit-border-radius:4px; -moz-border-radius:4px; border-radius:4px; background: #f8f8f8; border:1px solid #aaa; outline:none;}
    #tagSortButton {position: absolute; left: 630px; padding:3px; margin: 3px; height: 30px; -webkit-border-radius:4px; -moz-border-radius:4px; border-radius:4px; background: #f8f8f8; border:1px solid #aaa; outline:none;}
    #coordSysContainer {  }
    #coordSysSelect { position: absolute; right: 2px; border:none; outline:none; background: inherit; width: 80%; cursor:pointer;}


    #notificationBar {position: absolute; top: 90%; left: 0px; width: 100%; height: 40px; background: rgba(255,0,0,0.1); color:white; text-align: center; line-height: 35px; display:none; font-size:25px}
    #alarmBox_1 {position: absolute; top: 0; right: 0px; width: 25%; height: 0px; background: rgba(255,0,0,0.9); color:white; text-align: center; line-height: 25px; display:none; font-size:20px}
    #alarmBox_2 {position: absolute; top: 80px; right: 0px; width: 25%; height: 0px; background: rgba(255,120,0,0.9); color:white; text-align: center; line-height: 25px; display:none; font-size:20px}
    #AlarmBox_3 {position: absolute; top: 160px; right: 0px; width: 25%; height: 0px; background: rgba(255,0,0,0.9); color:white; text-align: center; line-height: 25px; display:none; font-size:20px}

    .tagRow {color: white; padding: 3px 3px 3px 5px; }
    .tagLabel {color: #aaaaaa; font-weight:bold;}
    .tagInfoRow {background: #444; margin-left: 5px; padding-left: 5px; border-left-color: #00CCFF; border-width: 0px 0px 0px 5px; border-style: solid;}
    .tagLocationRow {background: #444; margin-left: 5px; padding-left: 5px; border-left-color: #77DD77; border-width: 0px 0px 0px 5px; border-style: solid;}
    .colorbox { float: left; width: 13px; height: 13px; background: red; margin: 2px 5px 0px 0px;
      border-radius: 50%;  border-width: 2px; border-style: solid; /* animation: border-pulsate 2s infinite; */}

    #buttons {position:absolute; width: 100%; text-align:center; z-index:1000;}
    button { font-family:georgia; background:#000; color:#fff; padding:0.2em 0.5em; cursor:pointer; border-radius:5px; border-width:1px; border-color: #FFFFFF; z-index:1000; }
    button:hover { background:#333 }
    button.selected { background:#333 }

    #mapPanel canvas {
      -webkit-animation: fadein 2s; /* Safari, Chrome and Opera > 12.1 */
      -moz-animation: fadein 2s; /* Firefox < 16 */
      -ms-animation: fadein 2s; /* Internet Explorer */
      -o-animation: fadein 2s; /* Opera < 12.1 */
      animation: fadein 2s;
    }
    @keyframes fadein {
      from { opacity: 0; }
      to   { opacity: 1; }
    }
    .shadowframe {
      width: 100%;
      background: #fff;
      border-radius: 6px;
      margin-top: 5px;
      padding-top: 3px;
      padding-bottom: 5px;
      box-shadow: 1px 1px 3px rgba(0,0,0,.2);
    }
    .conten-box{
       overflow: hidden;
       overflow-y: scroll;
       white-space: nowrap;
       height:100%;
       width:100%;
     }
    .conten-box::-webkit-scrollbar {
       width: 0;
     }
  </style>
  <!--可无视 弹框样式-->
<!--  <link rel="stylesheet" type="text/css" href="/css/alert/normalize.css" />-->
<!--  <link rel="stylesheet" type="text/css" href="/css/alert/reset.css">-->
  <!--核心样式-->
  <link rel="stylesheet" type="text/css" href="/css/alert/style.css"/>
  <link href="/css/bootstrap.min.css" rel="stylesheet"/>
<!--  &lt;!&ndash; bootstrap-table 表格插件样式 &ndash;&gt;-->
  <link rel="shortcut icon" href="favicon.ico">
  <link href="/css/bootstrap.min.css" rel="stylesheet"/>
  <link href="/css/font-awesome.min.css" rel="stylesheet"/>
  <!-- bootstrap-table 表格插件样式 -->
  <link href="/ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
  <link href="/css/animate.css" rel="stylesheet"/>
  <link href="/css/style.css" rel="stylesheet"/>
  <link href="/ruoyi/css/ry-ui.css" rel="stylesheet"/>
  <link href="/ajax/libs/select2/select2.min.css" rel="stylesheet"/>
  <link href="/ajax/libs/select2/select2-bootstrap.css" rel="stylesheet"/>
  <link href="/ajax/libs/bootstrap-select/bootstrap-select.css" rel="stylesheet"/>

</head>
<body>
<!--</div>-->
<div id="container" style="background: #FFFFFF">
  <div id="leftPane" style="display: none">
    <div id="tagContainer"></div>
  </div>
  <div id="mapContainer">
    <div id="mapPanel" class="mapPanel"></div>

<!--    <img id="LogoSlogan"  th:src="@{/img/images/white_tm.png}" style="height: 105px"></img>-->
    <img id="drawer" th:src="@{/img/images/drawerHandle.png}" style="display: none"></img>
    <img id="people" th:src="@{/img/images/people-2.png}" style="display: none"></img>
    <img id="people3" th:src="@{/img/images/people-4.png}" style="display: none"></img>
    <div id="notificationBar"></div>
    <div id="alarmBox_1"></div>
    <div id="alarmBox_2"></div>
    <div id="AlarmBox_3"></div>
  </div>
</div>
<div  class="conten-box" style="float: right;width: 35%;background: #dff0d838">
  <div>
    <label class="shadowframe" style="top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;区域列表：</label>
    <div class="btn-group-sm" id="toolbar" role="group">
      <a class="btn btn-success" onclick="add()" shiro:hasPermission="system:area:add">
        <i class="fa fa-plus"></i> 添加
      </a>
      <a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:area:remove">
        <i class="fa fa-remove"></i> 删除
      </a>
    </div>
    <div class="col-sm-12 select-table table-striped" style="margin-top: 0px !important;padding-top:0px !important;padding-bottom:0px !important;">
      <table id="bootstrap-table" data-mobile-responsive="true"></table>
    </div>
  </div>
    <label class="shadowframe" style="width: 100%;margin-top:10px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;选中区域属性：</label>
  <div>
    <div class="" style="box-shadow: 1px 1px 3px rgba(0,0,0,.2);padding-left:5px">
      <div>
        <form class="form-horizontal m" id="form-area-edit" style="margin:0px">
          <div class="ibox-content">
            <div class="form-group">
              <label class="col-sm-3 control-label">编号：</label>
              <div class="col-sm-8">
                <input id="areaId" name="areaId" class="form-control" type="text" readonly>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">区域名称：</label>
              <div class="col-sm-8">
                <input id="areaName" name="areaName" class="form-control" type="text">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">规则：</label>
              <div class="col-sm-8">
                <select id="rule" name="rule" class="form-control noselect2" data-none-selected-text="请选择规则">
                  <!--                <option value="">请选择...</option>-->
                  <option value="1">禁入</option>
                  <option value="2">禁出</option>
                  <option value="3">巡检</option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">持续时间(秒)：</label>
              <div class="col-sm-8">
                <input id="ruleTime" name="ruleTime" class="form-control" value="0" type="text">
              </div>
            </div>

            <div class="form-group">
              <label class="col-sm-3 control-label">关联组织：</label>
              <div class="col-sm-8">
                <input name="associationDeptName" onclick="selectDeptTree()" id="associationDeptName" type="text" placeholder="请选择关联组织" class="form-control" readonly>
                <input name="associationDept" id="associationDept" type="hidden" placeholder="请选择关联组织" class="form-control" readonly>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">关联人员：</label>
              <div class="col-sm-8">
                <select id="associationPerson"  name="associationPerson"  class="form-control-1 noselect2 selectpicker" data-none-selected-text="请选择关联人员" multiple>
                  <option  th:each="option:${personList}" th:value="${option.personId}"
                           th:text="${option.personId}+'|'+${option.personName}"></option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">开始绘制：</label>
              <div class="col-sm-8">
                <input type="button" id="lineBtn" title="绘制线段"  onclick="selectOperation(3)" value="线段" style="background:url(/img/draw/bg-line.png) no-repeat center #2f96b4;border:none;text-indent:-2000px;width:60px;height:35px;border-radius:6px;background-size:50px">
                <input type="button" id="rectBtn" title="绘制矩形" onclick="selectOperation(1)" value="矩形" style="background:url(/img/draw/bg_rect.png) no-repeat center #2f96b4;border:none;text-indent:-2000px;width:60px;height:35px;border-radius:6px;background-size:50px">
                <input type="button" id="pylBtn" title="绘制多边形" onclick="selectOperation(2)" value="多边形" style="background:url(/img/draw/bg_pyl.png) no-repeat center #2f96b4;border:none;text-indent:-2000px;width:60px;height:35px;border-radius:6px;background-size:50px">
                <input type="button" id="clearRectMap" title="重新绘制"  value="重新绘制" style="background:url(/img/draw/refresh.png) no-repeat center #2f96b4;border:none;text-indent:-2000px;width:60px;height:35px;border-radius:6px;background-size:28px">
                <input id="drawWay" name="drawWay" class="form-control" type="hidden">
              </div>
            </div>
            <div class="form-group" style="display: none">
              <label class="col-sm-3 control-label">绘制数据：</label>
              <div class="col-sm-8">
                <input id="pointData" name="pointData" class="form-control" type="text">
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-12" style="text-align: center">
                <button id="saveBtn" onclick="save()" class="btn btn-info" type="button" style="margin-top: 8px">保存</button>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
<!--</div>-->

<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="/ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js"></script>
<script src="/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js"></script>
<script src="/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="/ajax/libs/validate/messages_zh.min.js"></script>
<script src="/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- jquery-export 表格导出插件 -->
<script src="/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
<script src="/ajax/libs/bootstrap-table/extensions/export/tableExport.js"></script>
<!-- 遮罩层 -->
<script src="/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="/ajax/libs/iCheck/icheck.min.js"></script>
<script src="/ajax/libs/layer/layer.min.js"></script>
<script src="/ajax/libs/layui/layui.js"></script>
<script src="/ruoyi/js/common.js?v=3.3.0"></script>
<script src="/ruoyi/js/ry-ui.js?v=3.3.0"></script>
<script> var ctx = "\/"; </script>
<script th:src="@{/js/config.js}"></script>
<!--<script src="/js/bootstrap.min.js"></script>-->
<!--<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>-->
<!--<script src="../static/js/map/lib/jquery-1.8.3.js" th:src="@{/js/map/lib/jquery-1.8.3.js}"></script>-->
<script src="../static/js/map/lib/jquery.mousewheel.js" th:src="@{/js/map/lib/jquery.mousewheel.js}"></script>
<script src="../static/js/map/lib/Three-r75.js" th:src="@{/js/map/lib/Three-r75.js}"></script>
<script src="../static/js/map/lib/dat.gui.min.js" th:src="@{/js/map/lib/dat.gui.min.js}"></script>
<script src="../static/js/map/settings.js" th:src="@{/js/map/settings.js}"></script>
<script src="../static/js/map/map2D/Map2DInteractionManagerFence.js" th:src="@{/js/map/map2D/Map2DInteractionManagerFence.js}"></script>
<script src="../static/js/map/SelectionManager.js" th:src="@{/js/map/SelectionManager.js}"></script>
<script src="../static/js/map/NotificationManager.js" th:src="@{/js/map/NotificationManager.js}"></script>
<script src="../static/js/map/filtering/TagFilter.js" th:src="@{/js/map/filtering/TagFilter.js}"></script>
<script src="../static/js/map/filtering/KeywordTagFilter.js" th:src="@{/js/map/filtering/KeywordTagFilter.js}"></script>
<script src="../static/js/map/filtering/CoordinateSystemTagFilter.js" th:src="@{/js/map/filtering/CoordinateSystemTagFilter.js}"></script>
<script src="../static/js/map/map2D/Map2DFenceController.js" th:src="@{/js/map/map2D/Map2DFenceController.js}"></script>
<script src="../static/js/map/map3D/Map3DController.js" th:src="@{/js/map/map3D/Map3DController.js}"></script>
<script src="../static/js/map/TreeController.js" th:src="@{/js/map/TreeController.js}"></script>
<script src="../static/js/map/map2D/Viewport.js" th:src="@{/js/map/map2D/Viewport.js}"></script>
<script src="../static/js/map/map2D/GridDrawable.js" th:src="@{/js/map/map2D/GridDrawable.js}"></script>
<script src="../static/js/map/map2D/PolygonDrawable.js" th:src="@{/js/map/map2D/PolygonDrawable.js}"></script>
<script src="../static/js/map/map2D/TagDrawable.js" th:src="@{/js/map/map2D/TagDrawable.js}"></script>
<script src="../static/js/map/map2D/BackgroundImageDrawable.js" th:src="@{/js/map/map2D/BackgroundImageDrawable.js}"></script>
<script src="../static/js/map/map2D/InactiveAreaRendererDrawable.js" th:src="@{/js/map/map2D/InactiveAreaRendererDrawable.js}"></script>
<script src="../static/js/map/map3D/DomeControls.js" th:src="@{/js/map/map3D/DomeControls.js}"></script>
<script src="../static/js/map/map3D/Stats.js" th:src="@{/js//map/map3D/Stats.js}"></script>
<script src="../static/js/map/TagDataRetrieverFence.js" th:src="@{/js/map/TagDataRetrieverFence.js}"></script>
<script src="../static/js/map/mainFence.js" th:src="@{/js/map/mainFence.js}"></script>
<script src="../static/js/map/map2D/Map2D.js" th:src="@{/js/map/map2D/Map2D.js}"></script>
<script src="../static/js/map/alert/jquery-translucent.js" th:src="@{/js/map/alert/jquery-translucent.js}"></script>
<script src="jcanvas.min.js" th:src="@{/js/map/map2D/jcanvas.min.js}"></script>
<!--<script th:src="@{/js/DrawingManager.js}"></script>-->
<script src="/ajax/libs/select2/select2.min.js"></script>
<script src="/ajax/libs/bootstrap-select/bootstrap-select.js"></script>
<script>
  $(document).ready(main);
  window.onload=function () {
    $("#mapCanvas").width("65%");
    $("#areaName").attr("readonly","readonly");
    $("#ruleTime").attr("readonly","readonly");
    $('#rule').attr("disabled",true);
    // $('#rule').style.backgroundColor="#eeeeee";
    document.getElementById('rule').style.background="#eeeeee";
    $('#associationPerson').attr("disabled",true);
    $('#associationDeptName').attr("disabled",true);
    $('#lineBtn').attr("disabled",true);
    $('#rectBtn').attr("disabled",true);
    $('#pylBtn').attr("disabled",true);
    $('#clearRectMap').attr("disabled",true);
    $('#saveBtn').attr("disabled",true);
  }
  // 去掉所有input的autocomplete, 显示指定的除外 
  // $(function(){
  //
  // });
  var prefix = "system/area";
  // var editFlag = [[${@permission.hasPermi('system:role:edit')}]];
  // var removeFlag = [[${@permission.hasPermi('system:role:remove')}]];
  $(function() {
    $('input:not([autocomplete]),textarea:not([autocomplete]),select:not([autocomplete])').attr('autocomplete', 'off');
    var options = {
      url: prefix + "/list",
      removeUrl: prefix + "/remove",
      modalName: "区域",
      showExport: false,
      showRefresh: false,                   // 是否显示刷新按钮
      showColumns: false,                   // 是否显示隐藏某列下拉框
      showToggle: false,
      showSearch:false,
      showFooter:false,
      sortName: "createTime",
      sortOrder: "desc",
      pageSize:10,
      height:300,
      onClickRow: onClickRow,
      columns: [{
        checkbox: true
      },
        {
          field : 'areaId',
          title : '编号',
          visible: true
        },
        {
          field : 'areaName',
          title : '区域名称',
          visible: true
        },
        {
          field : 'rule',
          title : '规则',
          visible: false
        },
        {
          field : 'ruleTime',
          title : '规则触发持续时间',
          visible: false
        },
        {
          field : 'associationPerson',
          title : '关联人员',
          visible: false
        },
        {
          field : 'associationDept',
          title : '关联组织',
          visible: false
        },
        {
          field : 'associationDeptName',
          title : '关联组织名称',
          visible: false
        },
        {
          title : '启动选项',
          visible: true,
          align: 'center',
          formatter: function (value, row, index) {
            return statusTools(row);
          }
        },
        {
          field : 'drawWay',
          title : '绘制方式',
          visible: false
        },
        {
          field : 'pointData',
          title : '绘制点数据',
          visible: false
        },
        {
          field : 'color',
          title : '颜色',
          visible: false
        },
        {
          field : 'createBy',
          title : '创建者',
          visible: false
        },
        {
          field : 'createTime',
          title : '创建时间',
          visible: false
        },
        {
          field : 'updateBy',
          title : '更新者',
          visible: false
        },
        {
          field : 'updateTime',
          title : '更新时间',
          visible: false
        },
        {
          field : 'remark',
          title : '备注',
          visible: false
        },
      ]
    };
    $.table.init(options);
  });
  /* 启用状态显示 */
  function statusTools(row) {
    if (row.isStart == 0) {
      return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.areaId + '\')"></i> ';
    } else {
      return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.areaId + '\')"></i> ';
    }
  }
  /* 区域管理启用 */
  function enable(areaId) {
    $.operate.post(prefix + "/changeStatus", { "areaId": areaId, "isStart": 1 });
  }
  /* 停用 */
  function disable(areaId) {
    $.operate.post(prefix + "/changeStatus", { "areaId": areaId, "isStart": 0 });
  }
  function add() {
    var config = {
      url: prefix+"/add",
      type: "post",
      dataType: "json",
      data: null,
      success: function(result) {
        // $.operate.successCallback(result);
        $.table.refresh();
      }
    };
    $.ajax(config)
  }
  function onClickRow(row, $element){
    $("#areaName").attr("readonly",false);
    $("#ruleTime").attr("readonly",false);
    $('#rule').attr("disabled",false);

    document.getElementById('rule').style.background="#ffffff";
    document.getElementById('associationDeptName').style.background="#ffffff";
    $(".bs-placeholder").css("background-color","#ffffff");

    $('#associationPerson').attr("disabled",false);
    $('#associationDeptName').attr("disabled",false);
    $('#lineBtn').attr("disabled",false);
    $('#rectBtn').attr("disabled",false);
    $('#pylBtn').attr("disabled",false);
    $('#clearRectMap').attr("disabled",false);
    $('#saveBtn').attr("disabled",false);

    $("#areaId").val(row.areaId);
    $("#areaName").val(row.areaName);
    // $("#rule").val(row.rule);
    if (row.rule!=""||row.rule!=null) {
      var ruleArr = new Array(row.rule);
      $("#rule").selectpicker('val',ruleArr);
      $("#rule").selectpicker('render');
      // $("#rule").selectpicker('mobile');
      // $("#rule").selectpicker('refresh');
    }
    $("#ruleTime").val(row.ruleTime);
    var associationPerson = row.associationPerson;
    var arr = new Array();
    if (associationPerson!=null&&associationPerson!=""){
      arr=associationPerson.split(',');
    }
    $("#associationPerson").selectpicker('val',arr);

    $("#associationPerson").selectpicker('render');
    // $("#associationPerson").selectpicker('mobile');
    // $("#associationPerson").selectpicker('refresh');
    // $("#associationPerson").val(row.associationPerson);
    $("#associationDept").val(row.associationDept);
    $("#associationDeptName").val(row.associationDeptName);
    $("#drawWay").val(row.drawWay);
    $("#pointData").val(row.pointData);
    $("#color").val(row.color);
    main();
  }
  var icon = "<i class='fa fa-times-circle'></i> ";
  $("#form-area-edit").validate({
    rules:{
      areaId:{
        required:true,
      },
      areaName:{
        minlength: 2,
        maxlength:20
      },
      ruleTime:{
        maxlength:8,
        digits:true,
      },
    },
    messages: {
      "areaId":{
        required:icon + "请选择一个区域"
      },
      "ruleTime": {
        digits: icon + "请输入整数"
      },
    },
    focusCleanup: true
  });
  function save() {
    if ($.validate.form()) {
      // 保存信息 刷新表格
        var config = {
          url: prefix + "/edit",
          type: "post",
          dataType: "json",
          data: $('#form-area-edit').serialize(),
          beforeSend: function () {
            $.modal.loading("正在处理中，请稍后...");
            $.modal.disable();
          },
          success: function(result) {
            // $.operate.successCallback(result);
            refreshItem();
          }
        };
        $.ajax(config);
      // $.operate.save(prefix + "/edit", $('#form-area-edit').serialize());
    }
  }
  function selectDeptTree() {
    var url = "/dataDept";
    $.modal.open("关联组织", url,300,400);
  }
  function setAssociationDept(value,name) {
    $("#associationDept").val(value);
    $("#associationDeptName").val(name);
  }
  /**
   * 设置select控件选中
   * @param selectId select的id值
   * @param checkValue 选中option的值
   */
  function set_select_checked(selectId, checkValue){
    var select = document.getElementById(selectId);
    for (var i = 0; i < select.options.length; i++){
      if (select.options[i].value == checkValue){
        select.options[i].selected = true;
        break;
      }
    }
  }

</script>

</body>
</html>
